<script type="text/javascript">
	$(function(){
		var id = $.randomBetween(100, 1000);
		$("#icaptcha").attr("src","<?=base_url()?>login/captcha/"+id+"");
		$("#icaptcha").click(function(){
			id = $.randomBetween(100, 1000);
            $("#icaptcha").attr("src","<?=base_url()?>login/captcha/"+id+"");
        });
		
		$("#reload").click(function(){ 
			id = $.randomBetween(100, 1000);
			var img = "<?=base_url()?>login/captcha/"+id;
            $("#icaptcha").attr("src",img);
        });
		 $("#error").val("");
		$("#btn_login").click(function(){
			 $("#error").val("");
			 var url = "<?=base_url()?>login/checklogin";
			 var username = $("#username").val();
			 var password = $("#password").val();
			 var txtcaptcha = $("#txtcaptcha").val();
			 $.ajax({
				  url:url,
				  async: false,
				  type: 'POST',
				  data:{username:username,password:password,txtcaptcha:txtcaptcha},
				  success:function(datas) {
					  if(datas != 1){
					  	 $("#error").html(datas);
					  }
					  else{
						  window.location = '<?=base_url()?>klgb.html';
					  }
				  }
			   });
		});
	});
</script>
<div class="w100pt">
      <div class="w450 mtop30 h20" id="error"></div>
</div>
<div class="login bd">
    <div class="w100pt fleft f20 MavenProOTF fcolor ">Đăng nhập</div>
    <div class="w100pt fleft mtop20">
        <div class="iconemail"><img class="imgmail" width="24" height="20" src="<?=url_tmpl()?>img/email.png" /></div>
        <div class="fleft"><input id="username" style="height:30px !important" placeholder="Tài khoản" class="txt_login"/></div>
        <div class="clear"></div>
    </div>
    <div class="w100pt fleft mtop20">
        <div class="iconemail"><img class="imgkey" width="22" height="22" src="<?=url_tmpl()?>img/key.png" /></div>
        <div class="fleft"><input id="password" style="height:30px !important" type="password" placeholder="Mật khẩu" class="txt_login" /></div>
        <div class="clear"></div>
    </div>
    <div class="w100pt fleft mtop20">
    		<div class="fleft">
           		<input id="txtcaptcha" style="height:30px !important" type="text" placeholder="Mã xác nhận" class="txt_login w200" />
           </div>
    	   <div class="fleft mleft10">
           		<img height="30"  title="Click chuột để tạo mã xác nhận khác"  src="<?=base_url()?>authorize/captcha/543534<?=url_suffix()?>" id="icaptcha" class="icaptchas">
           </div>
    	   <div class="fleft">
           	<img id="reload"  title="Click chuột để tạo mã xác nhận khác" style="cursor:pointer; margin-left:15px; margin-top:5px;" align="absmiddle" src="<?=url_tmpl();?>img/reload.png" />
           </div>
           
    </div>
    <div class="w100pt fleft mtop20">
        <div class="fleft mtop10"><input class="checkbox" type="checkbox" /></div>
        <div class="fleft mleft10 mtop10">Nhớ mật khẩu</div>
        <div id="btn_login" class="btn_login">Login</div>
        <div class="clear"></div>
    </div>
    <div class="clear"></div>
</div>